from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
    def __init__(self):
        HTMLParser.__init__(self)
        self.data = []

    def handle_starttag(self, tag, attrs):
        def _attr(attrlist, attrname):
            for each in attrlist:
                if attrname == each[0]:
                    return each[1]
            return None
        if tag == 'input' and _attr(attrs, 'name'):
            for (variable, value) in attrs:
                if variable == "value":
                    self.data.append(value)




class Pwd_call_back(HTMLParser):
    a_text = False

    def __init__(self):
        HTMLParser.__init__(self)
        self.data = []

    def handle_starttag(self, tag, attr):
        if tag == 'td':
            self.a_text = True
            # print (dict(attr))

    def handle_endtag(self, tag):
        if tag == 'td':
            self.a_text = False

    def handle_data(self, data):
        if self.a_text:
            # print(data)
            self.data.append(data)

if __name__ == "__main__":
    data = """
    <form action='https://36.110.98.254:19001/p2ph5/pc/checkPassword.html' method='get' enctype='text/plain' target='_blank' id='form1'><input type='hidden' name='systemCode' value='JCT'><input type='hidden' name='userId' value='1123432'><input type='hidden' name='signTime' value='1503458830450'><input type='hidden' name='signature' value='WEyK0j8N1s3QV/i378emLYLZY8el9Btewlx1Yrl+LwlTLEKokt35uSOfgmd3rHe0gQhslr8+tTp6ggJwH9y18NN0nbjfYgMjNzftKwuI6RYhzJfIZN3AOu8/ENVagbDLMuYKJo5luyL7tWyvmVq1FYXl0bfNvtgvYHSzBq1gCPk='><input type='hidden' name='businessSeqNo' value='JCT2017823588304473899'><input type='hidden' name='backURL' value='https://jctcg.9caitong.com/dep/pwd_call_back'>         \r\n                 </form>\r\n                <script>\r\n                    document.getElementById('form1').submit();\r\n                </script>
    """
    hp = MyHTMLParser()
    hp.feed(data)
    hp.close()
    print(hp.data[2],hp.data[3],hp.data[4])
    print(hp.data)